$(function() {
    var goods_id = getQueryString("goods_id");
    $.ajax({
        url: ApiUrl + "/index.php?act=goods&op=goods_body",
        data: {goods_id: goods_id},
        type: "get",
        success: function(result) {
            $(".fixed-tab-pannel").html(result);
        }
    });

    $('#goodsDetail').click(function(){
        window.location.href = WapSiteUrl+'/tmpl/product_detail.html?goods_id=' + goods_id;
    });
    $('#goodsBody').click(function(){
        window.location.href = WapSiteUrl+'/tmpl/product_info.html?goods_id=' + goods_id;
    });
    $('#goodsEvaluation').click(function(){
        window.location.href = WapSiteUrl+'/tmpl/product_eval_list.html?goods_id=' + goods_id;
    });
});
//取窗口滚动条高度
function getScrollTop(){
    var scrollTop=0;
    if(document.documentElement&&document.documentElement.scrollTop){
      scrollTop=document.documentElement.scrollTop;
    }else if(document.body){
      scrollTop=document.body.scrollTop;
    }
    return scrollTop;
  }
  // 取窗口可视范围的高度
  function getClientHeight(){
    var clientHeight=0;
    if(document.body.clientHeight&&document.documentElement.clientHeight){
      var clientHeight = (document.body.clientHeight<document.documentElement.clientHeight)?document.body.clientHeight:document.documentElement.clientHeight;
    }else{
      var clientHeight = (document.body.clientHeight>document.documentElement.clientHeight)?document.body.clientHeight:document.documentElement.clientHeight;
    }
    return clientHeight;
  }
  // 取文档内容实际高度
  function getScrollHeight(){
    return Math.max(document.body.scrollHeight,document.documentElement.scrollHeight);
  }

  // 判断是否到达底部
  function scrollAtBottom(){
    if (getScrollTop()+getClientHeight()==getScrollHeight()){
      return true;
    }else{
      return false;
    }
  }
$(function(){
  
  var bottom = false;
  $(window).scroll(function(){
    if (scrollAtBottom() && bottom){
      $("#goodsEvaluation").trigger('click');
    }

    if (scrollAtBottom() && !bottom){
      $('#smore').show();
      bottom = true;
    }
    
  })
})